package com.msy;

import com.msy.dao.TableDaoMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author Irving
 * @create 2021/7/8
 * @desc
 **/
public class Main {

    public static void main(String[] args) throws IOException {
        //加载配置到输入流
        InputStream resourceAsStream = Resources.getResourceAsStream("config.xml");
        SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        //得到Mapper
        TableDaoMapper mapper = sqlSession.getMapper(TableDaoMapper.class);
        for (String s : mapper.findTableList()) {
            System.out.println(s);
        }
        sqlSession.close();
    }

}
